$(function() {	
	$("div.pagination ul li a").bind("click",function(){
		if($(this).hasClass('noclick'))return;
		var link = $(this).attr("link");		
		doGet(link);		
	});
});


function loadDetails(panel,pid,code){
	$("#"+panel).toggle(500);	
	var url="contract/contract!details";
	$("#dcode").val(code);
	var data = $("#detailsform").serialize();
	$.post(url,data,function(content){
		$("#"+pid).html(content);
	});
}
function toggleValidation(self){	
	var form = $(self).parent();
	var data = form.serialize();
	var url='contract/contract!query';
	doPost(url,data);
}
function getCounter(exprval,exprid){
	$("#"+exprid).val(exprval);
	var data = $("#cform").serialize();
	var url="contract/contract!counterof";
	var event = window.event;
	var tgt = $(event.target);
	
	$.get(url,data,function(map){
	   	var cnt = map['counter'];
	   	var span = tgt.next("span");	   	
	   	span.html(cnt);
	});
}